package com.definity.toolkit.ui.style;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public final class StyleManager {

	private static StyleManager instance;
	
	private final Map<String, Style> styles = new HashMap<String, Style>();
	
	private StyleManager() {

	}
	
	public static synchronized StyleManager getInstance() {
		if (instance == null)
			instance = new StyleManager();
		return instance;
	}
	
	public StyleManager add(Style style) {
		styles.put(style.id(), style);
		return this;
	}
	
	public StyleManager remove(Style style) {
		styles.remove(style.id());
		return this;
	}

	public StyleManager remove(String id) {
		styles.remove(id);
		return this;
	}
	
	public Style style(String id) {
		return styles.get(id);
	}
	
	public Collection<Style> styles() {
		return styles.values();
	}
	
}
